﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Nancy;
using Nancy.ModelBinding;
using Nancy.Responses;
using API_Service.BizLogic.Platform;

namespace API_Service
{
    public class BaseAPIModule : NancyModule
    {
        private PlatformPubService service = new PlatformPubService();
        public BaseAPIModule()
        {
            //this.Before += ctx =>
            //{
            //    var parmas = this.Bind<UserDentity>();

            //    bool checkRes = service.CheckTokenIsExist(parmas).Status;

            //    return checkRes ? null : Response.AsJson(new ExecutionResult
            //    {
            //        Status = false,
            //        Token = parmas.Token,
            //        Message = "token is error or expire.",
            //        HttpCode = HttpStatusCode.Unauthorized
            //    });
            //};
        }

        public BaseAPIModule(string modulePath): base(modulePath)
        {
            //this.Before += ctx =>
            //{
            //    var parmas = this.Bind<UserDentity>();

            //    bool checkRes = service.CheckTokenIsExist(parmas).Status;

            //    return checkRes ? null : Response.AsJson(new ExecutionResult
            //    {
            //        Status = false,
            //        Token = parmas.Token,
            //        Message = "token is error or expire.",
            //        HttpCode = HttpStatusCode.Unauthorized
            //    });
            //};
        }
    }
}